package jmine.tec.utils.spring;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class MonitoredBean implements InitializingBean, DisposableBean {

    private static int createCount, initCount, destroyCount;

    {
        createCount++;
    }

    public void afterPropertiesSet() throws Exception {
        initCount++;
    }

    public void destroy() throws Exception {
        destroyCount++;
    }

    /**
     * @return the createCount
     */
    public static int getCreateCount() {
        return createCount;
    }

    /**
     * @param createCount the createCount to set
     */
    public static void setCreateCount(int createCount) {
        MonitoredBean.createCount = createCount;
    }

    /**
     * @return the initCount
     */
    public static int getInitCount() {
        return initCount;
    }

    /**
     * @param initCount the initCount to set
     */
    public static void setInitCount(int initCount) {
        MonitoredBean.initCount = initCount;
    }

    /**
     * @return the destroyCount
     */
    public static int getDestroyCount() {
        return destroyCount;
    }

    /**
     * @param destroyCount the destroyCount to set
     */
    public static void setDestroyCount(int destroyCount) {
        MonitoredBean.destroyCount = destroyCount;
    }

}
